package com.trendytech.tds.bean;


public class Osd {
	private String server;	
	private String path;
	private String name;
	private double crushWeight;
	private String status;
	private String up;
	private String in;
	private String stats;
	private double total;
	private double used;
	private double avail;
	private String totalCapacity;
	private String usedCapacity;
	private String availCapacity;
	private double perUsed;
	
	/**
	 * bytes_used 格式化  max_avail GB化
	 */
	public void format(){
		String[] s = {"KB","MB","GB","TB","PB"};
		if (1024 > this.total){
			this.totalCapacity = "0 KB";
		}
		else{
			int e = 0;
			double temp = this.total;
			temp /= 1024;
			while (temp >= 1024){
				temp /= 1024;
				e++;
			}
			this.totalCapacity = String.format("%.2f", temp)+ " " + s[e];
		}
		
		if (1024 > this.used){
			this.usedCapacity = "0 KB";
		}
		else{
			int e = 0;
			double temp = this.used;
			temp /= 1024;
			while (temp >= 1024){
				temp /= 1024;
				e++;
			}
			this.usedCapacity = String.format("%.2f", temp)+ " " + s[e];
		}
		
		if (1024 > this.avail){
			this.availCapacity = "0 KB";
		}
		else{
			int e = 0;
			double temp = this.avail;
			temp /= 1024;
			while (temp >= 1024){
				temp /= 1024;
				e++;
			}
			this.availCapacity = String.format("%.2f", temp)+ " " + s[e];
		}
		
	}
	
	
	public String getServer() {
		return server;
	}
	public void setServer(String server) {
		this.server = server;
	}
	public String getPath() {
		return path;
	}
	public void setPath(String path) {
		this.path = path;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public double getCrushWeight() {
		return crushWeight;
	}
	public void setCrushWeight(double crushWeight) {
		this.crushWeight = crushWeight;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	public String getUp() {
		return up;
	}
	public void setUp(String up) {
		this.up = up;
	}
	public String getIn() {
		return in;
	}
	public void setIn(String in) {
		this.in = in;
	}
	
	public String getStats() {
		return stats;
	}
	public void setStats(String stats) {
		this.stats = stats;
	}
	public double getTotal() {
		return total;
	}
	public void setTotal(double total) {
		this.total = total;
	}
	public double getUsed() {
		return used;
	}
	public void setUsed(double used) {
		this.used = used;
	}
	public double getAvail() {
		return avail;
	}
	public void setAvail(double avail) {
		this.avail = avail;
	}
	
	public String getTotalCapacity() {
		return totalCapacity;
	}


	public void setTotalCapacity(String totalCapacity) {
		this.totalCapacity = totalCapacity;
	}


	public String getUsedCapacity() {
		return usedCapacity;
	}


	public void setUsedCapacity(String usedCapacity) {
		this.usedCapacity = usedCapacity;
	}


	public String getAvailCapacity() {
		return availCapacity;
	}


	public void setAvailCapacity(String availCapacity) {
		this.availCapacity = availCapacity;
	}

	public double getPerUsed() {
		return perUsed;
	}
	public void setPerUsed(double perUsed) {
		this.perUsed = perUsed;
	}
	
}
